<?php
//后台首页控制器
namespace App\Http\Controllers\Home;

use App\Http\Model\Category;
use App\Http\Model\Goods;
use Illuminate\Http\Request;

use App\Http\Requests;

use App\Http\Model\Vip_user;
use Validator;


use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\Input;
use Gloudemans\Shoppingcart\Facades\Cart
use DB;

class CartController extends Controller
{
    //加载前台网站首页
    public function index($id)
    {
        $goods =Goods::find($id);
        $cart = Cart::add($goods->goods_title,$goods->goods_title,)
        return view("home.cart",compact("goods"));
    }
    //加载前台注册页面
    public function destory()
    {	
	     
    }
    //加载前台登录页面
    public function login()
    { 
        return view("home.login");
    }
    //加载前台列表页面
    public function Goods_list($id)
    {
        $list = Category::where('cate_pid','0')->get();
        $data = Category::get();
        $cate_list = Category::find($id);
        $goods_list =Goods::where('cate_id',$id)->get();
        return view("home.list",compact("list","data","goods_list","cate_list"));
    }
    //加载商品详情页面
    public function cargo($id)
    { 
       $list = Category::where('cate_pid','0')->get();
        $data = Category::get();
        $goods =Goods::find($id);   
        return view("home.cargo",compact("list","data","goods"));
    }

}
